﻿Option Explicit On

Imports System.IO
Imports Microsoft.VisualBasic

Public Class BlockOneHomework

    Shared Property MidiParent As MainForm

    Private Sub CloseToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles CloseToolStripMenuItem.Click
        Me.Close()
    End Sub

    Private Sub BlockOneHomework_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Dim lblList As New List(Of Control)
        lblList.Add(lblSection1Done)
        lblList.Add(lblSection2Done)
        lblList.Add(lblSection3Done)
        lblList.Add(lblSection4Done)
        lblList.Add(lblSection5Done)
        lblList.Add(lblSection6Done)
        lblList.Add(lblSection7Done)
        lblList.Add(lblSection8Done)
        lblList.Add(lblSection9Done)

        For Each i In lblList
            i.Text = "NOT DONE"
            i.BackColor = Color.Red
        Next

        'Call FileContainsData("C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section1HomeworkResults.txt", _
        '                      "C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section2HomeworkResults.txt", _
        '                      "C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section2HomeworkResults.txt", _
        '                      "C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section3HomeworkResults.txt", _
        '                      "C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section4HomeworkResults.txt", _
        '                      "C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section5HomeworkResults.txt", _
        '                      "C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section6HomeworkResults.txt", _
        '                      "C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section7HomeworkResults.txt", _
        '                      "C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section8HomeworkResults.txt", _
        '                      "C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section9HomeworkResults.txt")

        Dim Section1File As New StreamReader("C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section1HomeworkResults.txt")
        Dim Section2File As New StreamReader("C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section2HomeworkResults.txt")
        Dim Section3File As New StreamReader("C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section3HomeworkResults.txt")
        Dim Section4File As New StreamReader("C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section4HomeworkResults.txt")
        Dim Section5File As New StreamReader("C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section5HomeworkResults.txt")
        Dim Section6File As New StreamReader("C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section6HomeworkResults.txt")
        Dim Section7File As New StreamReader("C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section7HomeworkResults.txt")
        Dim Section8File As New StreamReader("C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section8HomeworkResults.txt")
        Dim Section9File As New StreamReader("C:\Users\DJWalshy\Documents\Homework\Block1\Block1Section9HomeworkResults.txt")

        Dim LastLines, LastLines2, LastLines3, LastLines4, LastLines5, _
        LastLines6, LastLines7, LastLines8, LastLines9 As String

        'Section1File.BaseStream.Seek(-8, SeekOrigin.End)
        'Section2File.BaseStream.Seek(-8, SeekOrigin.End)
        'Section3File.BaseStream.Seek(-8, SeekOrigin.End)
        'Section4File.BaseStream.Seek(-8, SeekOrigin.End)
        'Section5File.BaseStream.Seek(-8, SeekOrigin.End)
        'Section6File.BaseStream.Seek(-8, SeekOrigin.End)
        'Section7File.BaseStream.Seek(-8, SeekOrigin.End)
        ' Section8File.BaseStream.Seek(-8, SeekOrigin.End)
        'Section9File.BaseStream.Seek(-8, SeekOrigin.End)

        LastLines = Section1File.ReadToEnd
        LastLines2 = Section2File.ReadToEnd
        LastLines3 = Section3File.ReadToEnd
        LastLines4 = Section4File.ReadToEnd
        LastLines5 = Section5File.ReadToEnd
        LastLines6 = Section6File.ReadToEnd
        LastLines7 = Section7File.ReadToEnd
        LastLines8 = Section8File.ReadToEnd
        LastLines9 = Section9File.ReadToEnd

        '*******For Section 1**********
        If LastLines = "Complete" Then
            lblSection1Done.Text = "DONE"
            lblSection1Done.BackColor = Color.Green
        End If
        If LastLines2 = "Complete" Then
            lblSection2Done.Text = "DONE"
            lblSection2Done.BackColor = Color.Green
        End If
        If LastLines3 = "Complete" Then
            lblSection3Done.Text = "DONE"
            lblSection3Done.BackColor = Color.Green
        End If
        If LastLines4 = "Complete" Then
            lblSection4Done.Text = "DONE"
            lblSection4Done.BackColor = Color.Green
        End If
        If LastLines5 = "Complete" Then
            lblSection5Done.Text = "DONE"
            lblSection5Done.BackColor = Color.Green
        End If
        If LastLines6 = "Complete" Then
            lblSection6Done.Text = "DONE"
            lblSection6Done.BackColor = Color.Green
        End If

        If LastLines7 = "Complete" Then
            lblSection7Done.Text = "DONE"
            lblSection7Done.BackColor = Color.Green
        End If
        If LastLines8 = "Complete" Then
            lblSection8Done.Text = "DONE"
            lblSection8Done.BackColor = Color.Green
        End If
        If LastLines9 = "Complete" Then
            lblSection9Done.Text = "DONE"
            lblSection9Done.BackColor = Color.Green
        End If

    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        BlockOneHomeworkSectionOne.Show()
    End Sub

    Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click
        BlockOneHomeworkSectionFive.Show()
    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles SectionTwo.Click
        BlockOneHomeworkSectionTwo.Show()
    End Sub

    Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
        BlockOneHomeworkSectionThree.Show()
    End Sub

    Private Sub Button4_Click(sender As System.Object, e As System.EventArgs) Handles Button4.Click
        BlockOneHomeworkSectionFour.Show()
    End Sub

    Private Sub Button6_Click(sender As System.Object, e As System.EventArgs) Handles Button6.Click
        BlockOneHomeworkSectionOne.Show()
    End Sub

    Private Sub Button7_Click(sender As System.Object, e As System.EventArgs) Handles Button7.Click
        BlockOneHomeworkSectionSeven.Show()
    End Sub

    Private Sub Button8_Click(sender As System.Object, e As System.EventArgs)
        BlockOneHomeworkSectionEight.Show()
    End Sub

    Private Sub Button9_Click(sender As System.Object, e As System.EventArgs)
        BlockOneHomeworkSectionNine.Show()
    End Sub

    'Private Function FileContainsData(ByRef sFileName1 As String, ByRef sFileName2 As String, _
    '                                  ByRef sFileName3 As String, ByRef sFileName4 As String, _
    '                                  ByRef sFileName5 As String, ByRef sFileName6 As String, _
    '                                  ByRef sFileName7 As String, ByRef sFileName8 As String, _
    '                                  ByRef sFileName9 As String, ByRef sFileName10 As String) As Boolean

    'For counter As Integer = 1 To 9
    'Dim sr As StreamReader = New StreamReader(sFileName(counter))
    'Dim line As String
    'line = sr.ReadLine
    'If line = vbNullString = True Then
    'Call WritetoFile(sFileName(counter))
    'End If
    'Next
    'Return sFileName(counter)
    'End Function

    Private Function WritetoFile(sFileName As String)
        Dim fs As New System.IO.StreamWriter(sFileName, True)
        fs.WriteLine("Block 1 Homework")
        fs.Close()
        Return sFileName
    End Function

End Class